package org.bugeden.netdisk.vfs

import java.io.File

/**
 * Created by IntelliJ IDEA.
 * User: gzhang
 * Date: 2010-6-18
 * Time: 0:28:29
 * To change this template use File | Settings | File Templates.
 */

trait IDisk{
  import IDisk._
//  def isBind(): Boolean

//  def bind(user: String, psw: String): Unit

  def setLabel(label: String): Unit
  def label(): String

  @throws(classOf[FileExistException])
  @throws(classOf[FileNameIllegalException])
  def create(filename: String, fileForCreate: File): String

  def mkdir(path: String): String = throw new UnsupportedOperationException
  def mkdirs(path: String): String = throw new UnsupportedOperationException

  @throws(classOf[FileNotExistException])
  def update(filename: String, fileForUpdate: File): String

  @throws(classOf[FileNotExistException])
  def updateToLocalFile(filename: String, fileToUpdate: File): String

  @throws(classOf[FileNotExistException])
  def delete(file: String): String

  @throws(classOf[FileExistException])
  @throws(classOf[FileNameIllegalException])
  @throws(classOf[FileNotExistException])
  def move(from: String, to: String): String

  @throws(classOf[FileExistException])
  @throws(classOf[FileNameIllegalException])
  @throws(classOf[FileNotExistException])
  def copy(from: String, to: String): String

  @throws(classOf[FileNotExistException])
  def list(path: String): Array[String]

  def clear(): Unit

  def root(): String

}

object IDisk{
  class DiskException(msg: String = "") extends RuntimeException(msg)
  class FileExistException(msg: String = "") extends DiskException(msg)
  class FileNotExistException(msg: String = "") extends DiskException(msg)
  class FileNameIllegalException(msg: String = "") extends DiskException(msg)
  class DeleteFileException(msg: String = "") extends DiskException(msg)
}
